<?php include template("header");?>
<style>
h2{font-size: 19px;color: #999999;display: inline;padding-left: 10px;}
</style>
<div id="bdw" class="bdw">
<div id="bd" class="cf">
<div id="order-detail">
    <div id="content">
		<div class="box clear">
            <div class="box-top"></div>
            <div class="box-content">
             <?php if($donhang['state']!='pay'){?>
                <div class="head">
                    <div class="success"><h2>Đặt hàng thành công!</h2> </div>
                </div>
             <?php }?>
                <div class="sect">
<table cellspacing="0" cellpadding="0" border="0" >
    <tr>
        <th width="100px">Đơn hàng số  #</th>
        <td class="orderid"><h2><?php echo $donhang['code']; ?></h2></td>
    </tr>
    <tr>
        <th>Ngày đặt</th>
        <td><span><?php echo date('d-m-Y H:i',$donhang['create_time']); ?></span></td>
    </tr>
    <tr>
        <th>Tình trạng</th>
        <?php if($donhang['state']=='pay'){?>
        <td><span style="font-size: 15px; color: green">Đã thanh toán</span></td>
        <?php } else { ?>
        <td><span style="font-size: 15px; color: red;">Chưa thanh toán</span></td>
        <?php }?>
    </tr>
    
<?php if($order['condbuy']){?>
    <tr>
        <th>order options </th>
        <td colspan="3" class="status">{<?php echo $order['condbuy']; ?>}</td>
    </tr>
<?php }?>
<?php if($order['remark']){?>
    <tr>
        <th>notes：</th>
        <td colspan="3" class="status"><?php echo htmlspecialchars($order['remark']); ?></td>
    </tr>
<?php }?>
</table>
<table cellspacing="0" cellpadding="0" border="0" class="info-table">
    <tr>
        <th class="left" width="160px">Sản phẩm</th>
        <th width="35">Đơn giá (<?php echo $currency; ?>)</th>
        <th width="10"></th>
        <th width="45">Số lượng</th>
        <th width="10"></th>
        <th width="45">Thành tiền (<?php echo $currency; ?>)</th>
    </tr>
    <tr>
        <td class="left"><a href="/team.php?id=<?php echo $order['team_id']; ?>" target="_blank"><?php echo $sanpham['title']; ?></a></td>
        <td><?php echo formatMoney($donhang['price'],0); ?></td>
        <td>x</td>
        <td><?php echo $donhang['quantity']; ?></td>
        <td>=</td>
        <td class="total"><?php echo formatMoney($donhang['price']*$donhang['quantity'],0); ?></td>
    </tr>

<?php if($order['card_id']){?>
    <tr>
        <td class="left">card <?php echo $order['card_id']; ?></td>
        <td><?php echo moneyit($order['card']); ?></td>
        <td>x</td>
        <td>1</td>
        <td>=</td>
        <td class="total"><span class="money"><?php echo $currency; ?></span><?php echo moneyit($order['card']); ?></td>
        <td class="status">-</td>
    </tr>
<?php }?>

<?php if($sanpham['delivery']=='express' && $sanpham['fare']>0){?>
    <tr>
        <td class="left">Phí vận chuyển</td>
        <td><?php echo moneyit($sanpham['fare']); ?></td>
        <td>x</td>
        <td>1</td>
        <td>=</td>
        <td class="total"><?php echo moneyit($sanpham['fare']); ?></td>
    </tr>
<?php }?>
<?php if($sanpham['delivery']=='express'){?>
<tr><td colspan="3"><h2>Tổng tiền thanh toán</h2></td><td colspan="3"><h2><span class="money"><?php echo $tongtien; ?> <span class="money"><?php echo $currency; ?></span></span></h2></td></tr>
<?php }?>
</table>
<!--  show thong tin ngân hàng -->
<?php if($desc_payment != NULL){?>
<h2>Hình thức thanh toán: <?php echo $desc_payment; ?></h2><br>
<?php if($httt=='ct'){?>
<div id="note">
<?php if(!empty($INI['system']['companyname'])){?>
	<?php echo $INI['system']['companyname']; ?><br>
<?php }?>
<?php if(!empty($INI['system']['address'])){?>
	<?php echo $INI['system']['address']; ?><br>
<?php }?>
<?php if(!empty($INI['system']['tel'])){?>
	<?php echo $INI['system']['tel']; ?> - 
<?php }?>
<?php if(!empty($INI['system']['fax'])){?>
	<?php echo $INI['system']['fax']; ?><br>
<?php }?>
</div>
<?php }?><?php }?>
<?php if($nganhang['id']){?>
	<div id="note">
	<p>Bạn vui lòng chuyển khoản số tiền <b class="total"><?php echo $tongtien; ?></b> vào tài khoản bên dưới, sau khi xác nhận giao dịch, <?php echo $INI['system']['abbreviation']; ?> sẽ tiến hành kích hoạt tình trạng đơn hàng của Bạn sang trạng thái "Đã thanh toán" và nhân viên <?php echo $INI['system']['abbreviation']; ?> sẽ tiến hành giao phiếu đến Bạn</p>
	</div>
	<table cellspacing="0" cellpadding="0" border="0" class="data-table">
	<tr>
		<td><img alt="logo" src="../static/<?php echo $nganhang['image']; ?>" style="padding: 13px;"></td>
		<td>
			<div id="bank">
				<label>Chủ tài khoản: </label><?php echo $nganhang['bankacc']; ?><br>
				<label>Số tài khoản: </label><?php echo $nganhang['bankcode']; ?><br>
				<label>Ngân hàng: </label> <?php echo $nganhang['bankname_long']; ?>- <?php echo $nganhang['bankname_short']; ?><br>
			</div>		
		</td>
	</tr>
	</table><hr>
<?php }?>
<?php if($team['delivery']=='coupon'){?>
<table cellspacing="0" cellpadding="0" border="0" class="data-table">
    <tr>
        <th><?php echo $INI['system']['couponname']; ?> </th>
        <td class="other-coupon"><?php if(empty($coupons)){?><?php echo $INI['system']['couponname']; ?>would be sent to customers automatically after the deal tipped<?php }?><?php if(is_array($coupons)){foreach($coupons AS $one) { ?><p><?php echo $one['id']; ?> - <?php echo $one['secret']; ?></p><?php }}?></td>
    </tr>
    <tr>
        <th>using method </th>
        <td>before consumption, please show your<?php echo $INI['system']['couponname']; ?> to verify the coupon's No.and code with the biz.</td>
    </tr>
</table>
<?php } else if($sanpham['delivery']=='express') { ?>
<h2>Thông tin giao phiếu</h2>
<table cellspacing="0" cellpadding="0" border="0" class="data-table" style="width: 100%">
    <tr>
	<?php if($donhang['express_id']){?>
        <td>Đã giao phiếu bằng hình thức <?php echo $option_express[$donhang['express_id']]; ?></td>
	<?php } else { ?>
        <td colspan="2" class="other-coupon"><h2 style="color: red">Chờ nhận phiếu.</h2></td>
	<?php }?>
    </tr>
    <tr>
        <th>Người nhận </th>
        <td width="300px"><?php echo $donhang['realname']; ?></td>
    </tr>
    <tr>
        <th>Địa chỉ </th>
        <td><?php echo $donhang['address']; ?></td>
    </tr>
    <tr>
        <th>Điện thoại </th>
        <td><?php echo $donhang['mobile']; ?></td>
    </tr>
    <?php if($donhang['remark']!=""){?>
    <tr>
        <th>Chi chú </th>
        <td><?php echo $donhang['remark']; ?></td>
    </tr>
    <?php }?>    
    <tr><td colspan="4" style="text-align: right">
    	<input type="button" value="Xem giỏ hàng" class="formbutton" onclick="javascript:location='/user/gio-hang.html'">
    	<input type="button" value="Về trang chủ" class="formbutton" onclick="javascript:location='../'">
    </td></tr>
</table>
<?php } else if($team['delivery']=='pickup') { ?>
<table cellspacing="0" cellpadding="0" border="0" class="data-table">
    <tr>
        <th>self delivery </th>
        <td class="other-coupon"></td>
    </tr>
    <tr>
        <th>location </th>
        <td><?php echo $team['address']; ?></td>
    </tr>
    <tr>
        <th>telephone </th>
        <td><?php echo $team['mobile']; ?></td>
    </tr>
</table>
<?php }?>
                </div>
            </div>
            <div class="box-bottom"></div>
        </div>
    </div>
    <div id="sidebar">
    </div>
</div>

</div> <!-- bd end -->
</div> <!-- bdw end -->

<?php include template("footer");?>
